﻿<UserControl x:Class="MainGameModule.Views.QuestsPreview"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:converters="clr-namespace:MainGameModule.Views.Converters">
    
    <UserControl.Resources>
        <ResourceDictionary>
            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/YourWorld.Common;component/Styles/CommonResourcesDictionary.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <converters:BoolToImageSourceConverter x:Key="BoolToImageSourceConverter" />
            <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />

            <DataTemplate x:Key="QuestDataTemplate">
                <Grid Width="250">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image Source="/MainGameModule;component/Images/mark.png">
                        <ToolTipService.ToolTip>
                            <Grid>
                                <Image Source="{Binding Image}"                                       
                                       Height="100" />
                            </Grid>
                        </ToolTipService.ToolTip>
                    </Image>

                    <TextBlock Grid.Column="1"
					FontWeight="Bold"
					
                               Text="{Binding Title}"
                               TextWrapping="Wrap"
									   MaxWidth="110"
                               Foreground="#FFBAE231" />
                    <ListBox Grid.Row="1"
                             Grid.ColumnSpan="2"
                             Background="Transparent"
                             BorderThickness="0"
                             ItemsSource="{Binding RequiredBadges}"
                             Style="{StaticResource ListBoxNoSelectionStyle}"
                             ItemContainerStyle="{StaticResource ListBoxNoSelectionItemStyle}"
                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                             ScrollViewer.VerticalScrollBarVisibility="Disabled">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Text=" - " Foreground="White" FontWeight="Bold"/>
                                    <TextBlock Grid.Column="1" 
									Foreground="White" FontWeight="Bold"
                                               TextWrapping="Wrap"
                                               Text="{Binding Requires}" />
                                    <Image Grid.Column="2"
                                           Width="20"
                                           Height="20"
                                           Source="/MainGameModule;component/Views/images/ok.png"
                                           Visibility="{Binding IsLocked, Converter={StaticResource BoolToVisibilityConverter}}" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel x:Name="LayoutRoot"
                Visibility="{Binding AreQuestsAvailable, Converter={StaticResource BoolToVisibilityConverter}}">
        <TextBlock Text="Quests"
                   FontWeight="Bold"
                   Foreground="White" />
        <ListBox ItemsSource="{Binding PendingQuests}"
                 Background="Transparent"
                 BorderThickness="0"
                 MaxWidth="250"
                 ItemTemplate="{StaticResource QuestDataTemplate}"
                 Style="{StaticResource ListBoxNoSelectionStyle}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 ScrollViewer.VerticalScrollBarVisibility="Disabled"
                 ItemContainerStyle="{StaticResource ListBoxNoSelectionItemStyle}"/>
    </StackPanel>
</UserControl>
